package com.xj.demo.customedit;

import org.springframework.util.StringUtils;

import java.beans.PropertyEditorSupport;

public class CustomAddressEdit extends PropertyEditorSupport {
	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		if (StringUtils.hasText(text)){
			String[] arr = text.split("_");
			Address address = new Address();
			address.setProvince(arr[0]);
			address.setCity(arr[1]);
			address.setArea(arr[2]);
			setValue(address);
		}
	}
}
